import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home/Home.vue'
import Layout from '../views/Layout.vue'
import LayoutBack from '../views/BackStage/LayoutBack.vue'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    component: Layout,
    children: [{
        path: '/',
        name: 'Home',
        component: Home
      },
      {
        path: '/about',
        name: 'About',
        component: () => import('../views/About.vue')//关于我们
      },
      {
        path: '/joinus',
        name: 'JoinUs',
        component: () => import('../views/JoinUs.vue')//加入我们
      },
      {
        path: '/host',
        name: 'Host',
        component: () => import('../views/Host/Host.vue')//主持人
      }
    ]
  },
  {
    path: '/style',
    name: 'Style',
    component: () => import('../views/Style.vue')//主持人个人简介
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../components/HeadNav/Login.vue')
  },
  {
    path: '/loginback',
    name: 'LoginBack',
    component: () => import('../views/BackStage/LoginBack.vue')//登录
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../components/HeadNav/Register.vue')
  },{
    path: '/hostCenter',
    name: 'Center',
    component: () => import('../views/userCenter/HostCenter.vue')
  },{
    path: '/plannercenter',
    name: 'PlannerCenter',
    component: () => import('../views/userCenter/PlannerCenter.vue')
  },
  {
    path: '/layoutback',
    name: 'LayoutBack',
    component: LayoutBack,//后台管理页面
    children: [
      {
        path: '/layoutback/hostmanage',
        name: 'HostManage',
        component: () => import('../views/BackStage/Member/HostManage.vue')//主持人管理
      },
      {
        path: '/layoutback/wedding',
        name: 'Wedding',
        component: () => import('../views/BackStage/Member/Wedding.vue')//婚庆公司管理
      },
      {
        path: '/layoutback/newpeople',
        name: 'NewPeople',
        component: () => import('../views/BackStage/Member/NewPeople.vue')//新人管理
      },
      {
        path: '/layoutback/order',
        name: 'Order',
        component: () => import('../views/BackStage/Order/Order.vue')//主持人订单中心
      },
      {
        path: '/layoutback/banner',
        name: 'Banner',
        component: () => import('../views/BackStage/Content/Banner.vue')//banner管理
      },
      {
        path: '/layoutback/recommend',
        name: 'Recommend',
        component: () => import('../views/BackStage/Content/Recommend.vue')//首页推荐管理
      },
      {
        path: '/layoutback/bottom',
        name: 'Bottom',
        component: () => import('../views/BackStage/Content/Bottom.vue')//底部文案二维码设置
      },
      {
        path: '/layoutback/partner',
        name: 'Partner',
        component: () => import('../views/BackStage/Content/Partner.vue')//合作伙伴管理
      },
      {
        path: '/layoutback/jointeam',
        name: 'JoinTeam',
        component: () => import('../views/BackStage/Content/JoinTeam.vue')//加入团队介绍
      },
      {
        path: '/layoutback/aboutteam',
        name: 'AboutTeam',
        component: () => import('../views/BackStage/Content/AboutTeam.vue')//关于团队介绍
      },
      {
        path: '/layoutback/admin',
        name: 'Admin',
        component: () => import('../views/BackStage/Other/Admin.vue')//管理员配置
      },
      {
        path: '/layoutback/level',
        name: 'Level',
        component: () => import('../views/BackStage/Other/Level.vue')//支持人等级设置
      },
      {
        path: '/layoutback/money',
        name: 'Money',
        component: () => import('../views/BackStage/Other/Money.vue')//管理费记录
      },
    ]
  }
]

// const originalReplace = VueRouter.prototype.replace;
// VueRouter.prototype.replace = function replace(location) {
//   return originalReplace.call(this, location).catch(err => err);
// };

const router = new VueRouter({
  routes
})


export default router